<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>StringUtils.as</title>
<link rel="stylesheet" type="text/css" href="../../../../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptpackage">package</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">chewtinfoil</span>.<span class="ActionScriptDefault_Text">utils</span> <span class="ActionScriptBracket/Brace">{</span>

    <span class="ActionScriptASDoc">/**
    *     String Utilities class by Ryan Matsikas, Feb 10 2006
    *
    *    Visit www.gskinner.com for documentation, updates and more free code.
    *     You may distribute this code freely, as long as this comment block remains intact.
    */</span>

    <span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">StringUtils</span> <span class="ActionScriptBracket/Brace">{</span>

        <span class="ActionScriptASDoc">/**
        *    Returns everything after the first occurrence of the provided character in the string.
        *
        *    @param p_string The string.
        *
        *    @param p_begin The character or sub-string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">afterFirst</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">p_char</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns everything after the last occurence of the provided character in p_string.
        *
        *    @param p_string The string.
        *
        *    @param p_char The character or sub-string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">afterLast</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">lastIndexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">p_char</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string begins with the specified prefix.
        *
        *    @param p_string The string that the prefix will be checked against.
        *
        *    @param p_begin The prefix that will be tested against the string.
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">beginsWith</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_begin</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">false</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">RegExp</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;^&quot;</span><span class="ActionScriptOperator">+</span><span class="ActionScriptDefault_Text">p_begin</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">test</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns everything before the first occurrence of the provided character in the string.
        *
        *    @param p_string The string.
        *
        *    @param p_begin The character or sub-string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">beforeFirst</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns everything before the last occurrence of the provided character in the string.
        *
        *    @param p_string The string.
        *
        *    @param p_begin The character or sub-string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">beforeLast</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">lastIndexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns everything after the first occurance of p_start and before
        *    the first occurrence of p_end in p_string.
        *
        *    @param p_string The string.
        *
        *    @param p_start The character or sub-string to use as the start index.
        *
        *    @param p_end The character or sub-string to use as the end index.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">between</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_start</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_end</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&apos;&apos;</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">startIdx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_start</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">startIdx</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">startIdx</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">p_start</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptComment">// RM: should we support multiple chars? (or ++startIdx);
</span>                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">endIdx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_end</span>, <span class="ActionScriptDefault_Text">startIdx</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">endIdx</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">startIdx</span>, <span class="ActionScriptDefault_Text">endIdx</span><span class="ActionScriptOperator">-</span><span class="ActionScriptDefault_Text">startIdx</span><span class="ActionScriptBracket/Brace">)</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Description, Utility method that intelligently breaks up your string,
        *    allowing you to create blocks of readable text.
        *    This method returns you the closest possible match to the p_delim paramater,
        *    while keeping the text length within the p_len paramter.
        *    If a match can&apos;t be found in your specified length an  &apos;...&apos; is added to that block,
        *    and the blocking continues untill all the text is broken apart.
        *
        *    @param p_string The string to break up.
        *
        *    @param p_len Maximum length of each block of text.
        *
        *    @param p_delim delimter to end text blocks on, default = &apos;.&apos;
        *
        *    @returns Array
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">block</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>, <span class="ActionScriptDefault_Text">p_delim</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;.&quot;</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">arr</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span> <span class="ActionScriptOperator">||</span> <span class="ActionScriptOperator">!</span><span class="ActionScriptDefault_Text">contains</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span>, <span class="ActionScriptDefault_Text">p_delim</span><span class="ActionScriptBracket/Brace">))</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">arr</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">chrIndex</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> 0;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">strLen</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptReserved">while</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">chrIndex</span> <span class="ActionScriptOperator">&lt;</span>  <span class="ActionScriptDefault_Text">strLen</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">subString</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">chrIndex</span>, <span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">contains</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">subString</span>, <span class="ActionScriptDefault_Text">p_delim</span><span class="ActionScriptBracket/Brace">)){</span>
                    <span class="ActionScriptDefault_Text">arr</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">truncate</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">subString</span>, <span class="ActionScriptDefault_Text">subString</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">))</span>;
                    <span class="ActionScriptDefault_Text">chrIndex</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">subString</span>.<span class="ActionScriptDefault_Text">length</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">subString</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">subString</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">RegExp</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;[^&quot;</span><span class="ActionScriptOperator">+</span><span class="ActionScriptDefault_Text">p_delim</span><span class="ActionScriptOperator">+</span><span class="ActionScriptString">&quot;]+$&quot;</span><span class="ActionScriptBracket/Brace">)</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">arr</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">subString</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">chrIndex</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">subString</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">arr</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Capitallizes the first word in a string or all words..
        *
        *    @param p_string The string.
        *
        *    @param p_all (optional) Boolean value indicating if we should
        *    capitalize all words or only the first.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">capitalize</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, ...<span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">trimLeft</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">[</span>0<span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">===</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/^.|\s+(.)/</span>, <span class="ActionScriptDefault_Text">_upperCase</span><span class="ActionScriptBracket/Brace">)</span>;<span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">else</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/(^\w)/</span>, <span class="ActionScriptDefault_Text">_upperCase</span><span class="ActionScriptBracket/Brace">)</span>; <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string contains any instances of p_char.
        *
        *    @param p_string The string.
        *
        *    @param p_char The character or sub-string we are looking for.
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">contains</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">false</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptOperator">-</span>1;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines the number of times a charactor or sub-string appears within the string.
        *
        *    @param p_string The string.
        *
        *    @param p_char The character or sub-string to count.
        *
        *    @param p_caseSensitive (optional, default is true) A boolean flag to indicate if the
        *    search is case sensitive.
        *
        *    @returns uint
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">countOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_caseSensitive</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> 0; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">escapePattern</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flags</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">p_caseSensitive</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptString">&apos;ig&apos;</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptString">&apos;g&apos;</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">match</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">RegExp</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">char</span>, <span class="ActionScriptDefault_Text">flags</span><span class="ActionScriptBracket/Brace">))</span>.<span class="ActionScriptDefault_Text">length</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Levenshtein distance (editDistance) is a measure of the similarity between two strings,
        *    The distance is the number of deletions, insertions, or substitutions required to
        *    transform p_source into p_target.
        *
        *    @param p_source The source string.
        *
        *    @param p_target The target string.
        *
        *    @returns uint
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">editDistance</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_target</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>;

            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">p_source</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_target</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">p_target</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">p_target</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> 0; <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">cost</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">n</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_source</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">m</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_target</span>.<span class="ActionScriptDefault_Text">length</span>;

            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">n</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">m</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">m</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">=</span>0; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">&lt;=</span><span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">=</span>0; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">&lt;=</span><span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">][</span>0<span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">i</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span><span class="ActionScriptOperator">=</span>0; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">&lt;=</span><span class="ActionScriptDefault_Text">m</span>; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span>0<span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">j</span>; <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">=</span>1; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">&lt;=</span><span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>

                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">s_i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_source</span>.<span class="ActionScriptDefault_Text">charAt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">=</span>1; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">&lt;=</span><span class="ActionScriptDefault_Text">m</span>; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>

                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">t_j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_target</span>.<span class="ActionScriptDefault_Text">charAt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span>;

                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">s_i</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">t_j</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">cost</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptReserved">else</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">cost</span> <span class="ActionScriptOperator">=</span> 1; <span class="ActionScriptBracket/Brace">}</span>

                    <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">_minimum</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">+</span>1, <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">+</span>1, <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">+</span><span class="ActionScriptDefault_Text">cost</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">d</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">n</span><span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptDefault_Text">m</span><span class="ActionScriptBracket/Brace">]</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string ends with the specified suffix.
        *
        *    @param p_string The string that the suffic will be checked against.
        *
        *    @param p_end The suffix that will be tested against the string.
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">endsWith</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_end</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">RegExp</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_end</span><span class="ActionScriptOperator">+</span><span class="ActionScriptString">&quot;$&quot;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">test</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string contains text.
        *
        *    @param p_string The string to check.
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">hasText</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">removeExtraWhitespace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptOperator">!!</span><span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">length</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string contains any characters.
        *
        *    @param p_string The string to check
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">isEmpty</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">true</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptOperator">!</span><span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">length</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines whether the specified string is numeric.
        *
        *    @param p_string The string.
        *
        *    @returns Boolean
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">isNumeric</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">false</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">regx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">RegExp</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">/^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$/</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">regx</span>.<span class="ActionScriptDefault_Text">test</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        * Pads p_string with specified character to a specified length from the left.
        *
        *    @param p_string String to pad
        *
        *    @param p_padChar Character for pad.
        *
        *    @param p_length Length to pad to.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">padLeft</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_padChar</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_length</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">s</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>;
            <span class="ActionScriptReserved">while</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">s</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">p_length</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">s</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_padChar</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">s</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">s</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        * Pads p_string with specified character to a specified length from the right.
        *
        *    @param p_string String to pad
        *
        *    @param p_padChar Character for pad.
        *
        *    @param p_length Length to pad to.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">padRight</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_padChar</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_length</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">s</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>;
            <span class="ActionScriptReserved">while</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">s</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">p_length</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">s</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">p_padChar</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">s</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Properly cases&apos; the string in &quot;sentence format&quot;.
        *
        *    @param p_string The string to check
        *
        *    @returns String.
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">properCase</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">toLowerCase</span><span class="ActionScriptBracket/Brace">()</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\b([^.?;!]+)/</span>, <span class="ActionScriptDefault_Text">capitalize</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\b[i]\b/</span>, <span class="ActionScriptString">&quot;I&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Escapes all of the characters in a string to create a friendly &quot;quotable&quot; sting
        *
        *    @param p_string The string that will be checked for instances of remove
        *    string
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">quote</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">regx</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">RegExp</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">/[\\&quot;\r\n]/</span><span class="ActionScriptDefault_Text">g</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&quot;&apos;</span><span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">regx</span>, <span class="ActionScriptDefault_Text">_quote</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span><span class="ActionScriptString">&apos;&quot;&apos;</span>; <span class="ActionScriptComment">//&quot;
</span>        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Removes all instances of the remove string in the input string.
        *
        *    @param p_string The string that will be checked for instances of remove
        *    string
        *
        *    @param p_remove The string that will be removed from the input string.
        *
        *    @param p_caseSensitive An optional boolean indicating if the replace is case sensitive. Default is true.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">remove</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_remove</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_caseSensitive</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">rem</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">escapePattern</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_remove</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flags</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">p_caseSensitive</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptString">&apos;ig&apos;</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptString">&apos;g&apos;</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">RegExp</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">rem</span>, <span class="ActionScriptDefault_Text">flags</span><span class="ActionScriptBracket/Brace">)</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Removes extraneous whitespace (extra spaces, tabs, line breaks, etc) from the
        *    specified string.
        *
        *    @param p_string The String whose extraneous whitespace will be removed.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">removeExtraWhitespace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">trim</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\s+/</span><span class="ActionScriptDefault_Text">g</span>, <span class="ActionScriptString">&apos; &apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns the specified string in reverse character order.
        *
        *    @param p_string The String that will be reversed.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">reverse</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">split</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">reverse</span><span class="ActionScriptBracket/Brace">()</span>.<span class="ActionScriptDefault_Text">join</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns the specified string in reverse word order.
        *
        *    @param p_string The String that will be reversed.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">reverseWords</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">split</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\s+/</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">reverse</span><span class="ActionScriptBracket/Brace">()</span>.<span class="ActionScriptDefault_Text">join</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determines the percentage of similiarity, based on editDistance
        *
        *    @param p_source The source string.
        *
        *    @param p_target The target string.
        *
        *    @returns Number
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">similarity</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_target</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">ed</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">editDistance</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span>, <span class="ActionScriptDefault_Text">p_target</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">maxLen</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">max</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_source</span>.<span class="ActionScriptDefault_Text">length</span>, <span class="ActionScriptDefault_Text">p_target</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">maxLen</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> 100; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">else</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptBracket/Brace">(</span>1 <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">ed</span><span class="ActionScriptOperator">/</span><span class="ActionScriptDefault_Text">maxLen</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">*</span> 100; <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Remove&apos;s all &lt; and &gt; based tags from a string
        *
        *    @param p_string The source string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">stripTags</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/&lt;\/?[^&gt;]+&gt;/</span><span class="ActionScriptDefault_Text">igm</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Swaps the casing of a string.
        *
        *    @param p_string The source string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">swapCase</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/(\w)/</span>, <span class="ActionScriptDefault_Text">_swapCase</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Removes whitespace from the front and the end of the specified
        *    string.
        *
        *    @param p_string The String whose beginning and ending whitespace will
        *    will be removed.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">trim</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/^\s+|\s+$/</span><span class="ActionScriptDefault_Text">g</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Removes whitespace from the front (left-side) of the specified string.
        *
        *    @param p_string The String whose beginning whitespace will be removed.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">trimLeft</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/^\s+/</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Removes whitespace from the end (right-side) of the specified string.
        *
        *    @param p_string The String whose ending whitespace will be removed.
        *
        *    @returns String    .
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">trimRight</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\s+$/</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Determins the number of words in a string.
        *
        *    @param p_string The string.
        *
        *    @returns uint
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">wordCount</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> 0; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">match</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\b\w+\b/</span><span class="ActionScriptDefault_Text">g</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">length</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptASDoc">/**
        *    Returns a string truncated to a specified length with optional suffix
        *
        *    @param p_string The string.
        *
        *    @param p_len The length the string should be shortend to
        *
        *    @param p_suffix (optional, default=...) The string to append to the end of the truncated string.
        *
        *    @returns String
        *
        *     @langversion ActionScript 3.0
        *    @playerversion Flash 9.0
        *    @tiptext
        */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">truncate</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>, <span class="ActionScriptDefault_Text">p_suffix</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;...&quot;</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_len</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">undefined</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">p_len</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptDefault_Text">p_len</span> <span class="ActionScriptOperator">-=</span> <span class="ActionScriptDefault_Text">p_suffix</span>.<span class="ActionScriptDefault_Text">length</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">trunc</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_string</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">trunc</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">&gt;</span> <span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">trunc</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">trunc</span>.<span class="ActionScriptDefault_Text">substr</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/[^\s]/</span>.<span class="ActionScriptDefault_Text">test</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span>.<span class="ActionScriptDefault_Text">charAt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_len</span><span class="ActionScriptBracket/Brace">)))</span> <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">trunc</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">trimRight</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">trunc</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/\w+$|\s+$/</span>, <span class="ActionScriptString">&apos;&apos;</span><span class="ActionScriptBracket/Brace">))</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">trunc</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">p_suffix</span>;
            <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">trunc</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptComment">/* **************************************************************** */</span>
        <span class="ActionScriptComment">/*    These are helper methods used by some of the above methods.        */</span>
        <span class="ActionScriptComment">/* **************************************************************** */</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">escapePattern</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_pattern</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptComment">// RM: might expose this one, I&apos;ve used it a few times already.
</span>            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_pattern</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">/(\]|\[|\{|\}|\(|\)|\*|\+|\?|\.|\\)/</span><span class="ActionScriptDefault_Text">g</span>, <span class="ActionScriptString">&apos;\\$1&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_minimum</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">a</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>, <span class="ActionScriptDefault_Text">b</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>, <span class="ActionScriptDefault_Text">c</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">min</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">a</span>, <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">min</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">b</span>, <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">min</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">c</span>,<span class="ActionScriptDefault_Text">a</span><span class="ActionScriptBracket/Brace">)))</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_quote</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, ...<span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">switch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_string</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;\\&quot;</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&quot;\\\\&quot;</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;\r&quot;</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&quot;\\r&quot;</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;\n&quot;</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&quot;\\n&quot;</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&apos;&quot;&apos;</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;\\&quot;&apos;</span>;
                <span class="ActionScriptReserved">default</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&apos;&apos;</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_upperCase</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, ...<span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_char</span>.<span class="ActionScriptDefault_Text">toUpperCase</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_swapCase</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, ...<span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">lowChar</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_char</span>.<span class="ActionScriptDefault_Text">toLowerCase</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">upChar</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">p_char</span>.<span class="ActionScriptDefault_Text">toUpperCase</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptReserved">switch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p_char</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">lowChar</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">upChar</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">upChar</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">lowChar</span>;
                <span class="ActionScriptReserved">default</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">p_char</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>

    <span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
